//
//  HomeViewController.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/9.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "StoreListInfoCell.h"
#import "HomeViewController.h"
#import "WorkPlatformViewController.h"

@interface HomeViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UIImageView *headImageView;
@property (weak, nonatomic) IBOutlet UILabel *headTitle;

@property (weak, nonatomic) IBOutlet UIImageView *headBGImageView;

@property (weak, nonatomic) IBOutlet UILabel *storeCountLab;

@property (weak, nonatomic) IBOutlet UIView *saoyisaoAction;

@property (weak, nonatomic) IBOutlet UITableView *tableview;

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];


    [self initView];

}

- (void)initView {
    
    self.navigationController.navigationBarHidden = YES;
    #if RT_INTERACTIVE_PUSH
        self.rt_navigationController.rt_enableInteractivePush = YES;
    #endif
    
    self.tableview.delegate = self;
    self.tableview.dataSource = self;
    self.tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableview.backgroundColor =  UIColorHex(0xf1f1f1);

    self.tableview.showsHorizontalScrollIndicator = NO;
    self.tableview.showsVerticalScrollIndicator = NO;
    
    self.tableview.estimatedSectionHeaderHeight = 0;
    self.tableview.estimatedSectionFooterHeight = 0;
    self.tableview.estimatedRowHeight = 0;
    
    [self.tableview registerNib:[UINib nibWithNibName:@"StoreListInfoCell" bundle:nil] forCellReuseIdentifier:@"StoreListInfoCellID"];
    
    [self.tableview reloadData];
}

#pragma mark UITableviewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 20;
}

//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
//    return 50;
//}
//
//-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
//    return CGFLOAT_MIN;
//}

#pragma mark sectionheader

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 120;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    WorkPlatformViewController *vc = [[WorkPlatformViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
    
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    StoreListInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"StoreListInfoCellID"];
    cell.selectionStyle =UITableViewCellSelectionStyleNone;

    return cell;
}

@end
